<template>
    <view :style="themeColor">
        <view class="page" >
    <view class="flex flex-wrap align-center justify-between benben-position-layout flex informationSettlement_flex_0"    :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
            <view   class='flex flex-wrap align-center informationSettlement_fd0_0'   @tap="handleJumpDiy" data-type="redirectTo" :data-url="`/pages/wd/informationAuthentication/informationAuthentication`"   >
        <image class='informationSettlement_fd0_0_c0'  mode="aspectFit"  :src='STATIC_URL+"234.png"'></image>
</view>
<text class='informationSettlement_fd0_1'  >结算信息</text>
    <view   class='flex flex-wrap align-center informationSettlement_fd0_0'      >
        </view>

        </view>
<view :style="{height: (88+StatusBarRpx)+'rpx'}"  ></view>
<!---结算信息flex布局开始-->
 <view class="flex flex-direction align-stretch benben-flex-layout informationSettlement_flex_1"    >
            <view   class='flex flex-direction align-stretch informationSettlement_fd1_0'    v-if= "dataMessage.account_type!='3'"  >
            <view   class='flex align-center justify-between informationSettlement_fd1_0_c0'   @tap.stop="pickerDiy1680052944373=true"   >
        <text class='informationSettlement_fd1_0_c0_c0'  >{{$t('结算类型')}}</text>
<input class='flex-sub informationSettlement_fd1_0_c0_c1'   type="text" :placeholder="`微信`" confirm-type="done" :maxlength="-1" :disabled='true' placeholder-style="color:#999;font-size:32rpx"  v-model="settlement_name" />
<image class='informationSettlement_fd1_0_c0_c2'  mode="aspectFit"  :src='STATIC_URL+"126.png"'></image>
</view>
    <view   class='flex align-center justify-between informationSettlement_fd1_0_c1'      >
        <text class='informationSettlement_fd1_0_c0_c0'  >{{$t('结算账户')}}</text>
<input class='flex-sub informationSettlement_fd1_0_c1_c1'   type="text" :placeholder="$t('请输入结算账户')" confirm-type="done" :maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx"  v-model="dataMessage.account_id" />
</view>
    <view   class='flex align-center justify-between informationSettlement_fd1_0_c0'      >
        <text class='informationSettlement_fd1_0_c0_c0'  >{{$t('收款二维码')}}</text>
<view class="upload position-relative">
    
     <image class=" informationSettlement_fd1_0_c2_c1_image" mode="aspectFit"  @tap="soloChooseImage('qrcode','qrcode',dataMessage,dataMessage)" :src="dataMessage.qrcode ? dataMessage.qrcode : STATIC_URL+'327.png'"></image>
</view>
</view>
    <view   class='flex align-center justify-between informationSettlement_fd1_0_c3'      >
        <text class='informationSettlement_fd1_0_c0_c0'  >{{$t('真实姓名')}}</text>
<input class='flex-sub informationSettlement_fd1_0_c1_c1'   type="text" :placeholder="$t('请输入结真实姓名')" confirm-type="done" :maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx"  v-model="dataMessage.true_name" />
</view>
</view>
    <view   class='flex flex-direction align-stretch informationSettlement_fd1_1'    v-if= "dataMessage.account_type=='3'"  >
            <view   class='flex align-center justify-between informationSettlement_fd1_0_c0'   @tap.stop="pickerDiy1680052944373=true"   >
        <text class='informationSettlement_fd1_1_c0_c0'  >{{$t('结算类型')}}</text>
<input class='flex-sub informationSettlement_fd1_1_c0_c1'   type="text" :placeholder="`微信`" confirm-type="done" :maxlength="-1" :disabled='true' placeholder-style="color:#999;font-size:28rpx"  v-model="settlement_name" />
<image class='informationSettlement_fd1_0_c0_c2'  mode="aspectFit"  :src='STATIC_URL+"126.png"'></image>
</view>
    <view   class='flex align-center justify-between informationSettlement_fd1_0_c1'      >
        <text class='informationSettlement_fd1_1_c1_c0'  >{{$t('结算账户')}}</text>
<input class='flex-sub informationSettlement_fd1_0_c1_c1'   type="text" :placeholder="$t('请输入银行卡号')" confirm-type="done" :maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx"  v-model="dataMessage.account_id" />
</view>
    <view   class='flex align-center justify-between informationSettlement_fd1_0_c0'      >
        <text class='informationSettlement_fd1_1_c1_c0'  >{{$t('结算开户行')}}</text>
<input class='flex-sub informationSettlement_fd1_0_c1_c1'   type="text" :placeholder="$t('请输入银行卡开户名')" confirm-type="done" :maxlength="19" placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx"  v-model="dataMessage.account_name" />
</view>
    <view   class='flex align-center justify-between informationSettlement_fd1_0_c0'      >
        <text class='informationSettlement_fd1_1_c0_c0'  >{{$t('结算开户银行支行名称')}}</text>
<input class='flex-sub informationSettlement_fd1_0_c1_c1'   type="text" :placeholder="$t('请输入结算开户银行支行名称')" confirm-type="done" :maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:28rpx"  v-model="dataMessage.bank_branch" />
</view>
    <view   class='flex align-center justify-between informationSettlement_fd1_0_c3'      >
        <text class='informationSettlement_fd1_1_c0_c0'  >{{$t('结算开户银行所在地')}}</text>
<input class='flex-sub informationSettlement_fd1_0_c1_c1'   type="text" :placeholder="$t('请输入结算开户银行所在地')" confirm-type="done" :maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:28rpx"  v-model="dataMessage.bank_address" />
</view>
</view>
    <view   class='flex flex-wrap align-start justify-center informationSettlement_fd1_2'      >
        <button class='informationSettlement_fd1_2_c0'  @tap="handleJumpDiy" data-type="redirectTo" :data-url="`/pages/wd/informationAuthentication/informationAuthentication`"  >上一步</button>
<button class='informationSettlement_fd1_2_c1'  @tap.stop="submitMessageFunc()"  >下一步</button>
</view>
</view>
        
<!---结算信息flex布局结束-->
<!--结算类型选择器开始 -->
        <benben-picker ref="benbenWritePickerCodepicker2" :visible.sync="pickerDiy1680052944373" :label.sync='settlement_name' :value.sync='dataMessage.account_type' :options='settlement_type'  mode='selector' :mask-show='true' :timeout='true' :picker-height='88' default-type='value' :default-props='{"label":"name","value":"value"}'  >
            <template #picker-header>
        <view   class='flex flex-wrap align-center justify-between informationSettlement_picker2_0'      >
        <text class='informationSettlement_picker2_0_c0'  @tap="$refs.benbenWritePickerCodepicker2.cancel()" >取消</text>
<text   ></text>
<text class='informationSettlement_picker2_0_c2'  @tap="$refs.benbenWritePickerCodepicker2.pickerConfirm()" >确定</text>
</view>
</template>
        </benben-picker>
<!--结算类型选择器结束 -->
    
    
        </view>
    </view>
</template>
<script>
    import UploadImage from '@/common/utils/upload-image.js'
import {validate} from '@/common/utils/validate.js'
    export default {
        components:{},
        
        
        data(){
			return {"pickerDiy1680052944373":false,"dataMessage":{"aid":"","member_id":"","member_account":"","member_name":"","person":"","idcard_no":"","province_idc":"","province_name":"","city_id":"","city_name":"","district_id":"","district_name":"","address":"","store_province_id":"","store_province_name":"","store_city_id":"","store_city_name":"","store_district_id":"","store_district_name":"","store_address":"","contacts_name":"","contacts_phone":"","idcard_front":"","idcard_reverse":"","store_name":"","store_logo":"","business_licence":"","joinin_state":"","joinin_message":"","range":"","reason":"","merchant_ratio":"","apply_type":"","company_name":"","company_province_id":"","company_city_id":"","company_district_id":"","company_address":"","credit_code":"","store_level":"","main_industry":"","stay_time":"","pay_img":"","pay_remarks":"","pay_money":"","pay_time":"","run_type":"","expiration_time":"","store_backdrop":"","service_phone":"","store_introduce":"","workday":"","business_hours":"","enter_money":"","qualification_certificate":"","create_time":"","true_name":"","account_id":"","qrcode":"","bank_branch":"","bank_address":"","company_address_id":"","account_type":"","account_name":"","run_type_id":"","stay_time_id":"","main_industry_id":""},"settlement_type":[{"name":"微信","value":"1","image":""},{"name":"支付宝","value":"2","image":""},{"name":"银行卡","value":"3","image":""}],"settlement_name":"","name":""};
		},
		computed:{
            themeColor() {
              return this.$store.getters.themeColor
            },
                          userInfo: {
      get() {
        return this.$store.state.userInfo
      },
      set() {
        this.$store.commit('updateUserInfo', value)
      },
    }
		},
		watch:{},
		onLoad(options){
            let {name}=options
if (name !== undefined) this.name = name
this.queryDetailFunc()
		},
        onUnload() {
                
        },
		onReady(){
            
		},
		onShow(){
            
		},
		onHide(){
            
		},
		onResize(){
            
		},
		onPullDownRefresh(){
            
		},
		onReachBottom(e){
            
		},
		onPageScroll(e){
            
		},
		methods:{
                         //上传单图、多图方法
    soloChooseImage(id, path, obj, obj1, fnName = false) {
      let self = this
      if (!obj) obj = this
      if (!obj1) obj1 = this
      if (self.uploading) {
        return
      }
      // 从相册中选择图片
      uni.chooseImage({
        count: 1, // 默认3
        sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
        success: function (res) {
          self.uploading = true
          // 开始上传
          new UploadImage(res.tempFiles, {
            complete: function (res) {
              self.uploading = false
              if (id) self.$set(obj, id, res[0].id)
              if (path) self.$set(obj1, path, res[0].path)
              if (fnName) self[fnName]()
            },
          })
        },
      })
    },
                //商家入驻-商家申请开店详情
                async queryDetailFunc(){
                        //请求方法
    //数据验证
    
  let datadataMessage = await this.$api.get(global.apiUrls.post62be7019e6ae4, {
    
  });
  
  if (datadataMessage.data.code != 1) {
    this.$message.info(datadataMessage.data.msg);
    return
  } 
  let infodataMessage = datadataMessage.data;
  this.dataMessage = infodataMessage.data
  
    if( this.dataMessage.account_type==''){
           this.dataMessage.account_type = '1';
    }
    if( this.dataMessage.account_type=='1'){
           this.settlement_name = '微信';
    }
    else if( this.dataMessage.account_type=='2'){
           this.settlement_name = '支付宝';
    }
    else if( this.dataMessage.account_type=='3'){
           this.settlement_name = '银行卡';
    }
                },
                //提交结算信息
                async submitMessageFunc(){
                                if(!validate(this.dataMessage.account_type,'require')){
                 this.$message.info('请选择结算类型');
                 return false;
            }
            if(!validate(this.dataMessage.account_id,'require')){
                 this.$message.info('请输入结算账户');
                 return false;
            }
    if( this.dataMessage.account_type=='3'){
                    if(!validate(this.dataMessage.account_id,'card')){
                 this.$message.info('请输入正确的银行卡号');
                 return false;
            }
            if(!validate(this.dataMessage.account_name,'require')){
                 this.$message.info('请输入银行卡开户名');
                 return false;
            }
            if(!validate(this.dataMessage.bank_branch,'require')){
                 this.$message.info('请输入结算开户银行支行名称');
                 return false;
            }
            if(!validate(this.dataMessage.bank_address,'require')){
                 this.$message.info('请输入结算开户银行所在地');
                 return false;
            }
    }
    if( this.dataMessage.account_type!='3'){
                    if(!validate(this.dataMessage.qrcode,'require')){
                 this.$message.info('请上传收款二维码');
                 return false;
            }
            if(!validate(this.dataMessage.true_name,'require')){
                 this.$message.info('请输入真实姓名');
                 return false;
            }
    }
    //请求方法
    //数据验证
    
  let data63720a005dddf = await this.$api.post(global.apiUrls.post63720a005dddf, {
    true_name:this.dataMessage.true_name,account_type:this.dataMessage.account_type,account_id:this.dataMessage.account_id,qrcode:this.dataMessage.qrcode,account_name:this.dataMessage.account_name,bank_branch:this.dataMessage.bank_branch,bank_address:this.dataMessage.bank_address,user_id:this.userInfo.id
  });
  
  if (data63720a005dddf.data.code != 1) {
    this.$message.info(data63720a005dddf.data.msg);
    return
  } 
  
  
  
    this.$urouter.redirectTo(`/pages/wd/informationShop/informationShop?name=${this.dataMessage.store_name}`);
                }
		}
    };
</script> 
<style lang="scss" scoped>
           .page{
            width: 100vw;
            overflow-x: hidden;
            min-height: calc(100vh - var(--window-bottom));
            background:#fff;background-size: 100% auto;
        }
    .informationSettlement_flex_0{
        background:#fff;width:750rpx;height:88rpx;overflow:hidden;z-index:10;top:0rpx;background-size:100% auto !important;
    }
    .informationSettlement_fd0_1{
        color:#333333;font-size:36rpx;font-weight:500;line-height:50rpx;
    }
    .informationSettlement_fd0_0_c0{
        width:20rpx;height:36rpx;border-radius:0rpx 0rpx 0rpx 0rpx;margin:0rpx 0rpx 0rpx 32rpx;
    }
    .informationSettlement_fd0_0{
        width:100rpx;height:88rpx;
    }
    .informationSettlement_flex_1{
        background:var(--benbenbgColor1);background-size:100% auto !important;
    }
    .informationSettlement_fd1_2_c1{
        background:var(--benbenbgColor7);border-radius:100rpx 100rpx 100rpx 100rpx;font-size:32rpx;color:var(--benbenFontColor3);width:328rpx;height:88rpx;line-height:88rpx;font-weight:500;margin:0rpx 0rpx 0rpx 32rpx;
    }
    .informationSettlement_fd1_2_c0{
        border:1px solid var(--benbenbdColor0);background:var(--benbenbgColor1);border-radius:100rpx 100rpx 100rpx 100rpx;font-size:32rpx;color:var(--benbenFontColor5);width:328rpx;height:88rpx;line-height:88rpx;font-weight:500;
    }
    .informationSettlement_fd1_2{
        background:var(--benbenbgColor1);position:fixed;width:750rpx;height:120rpx;bottom:calc(0rpx + var(--window-bottom));left:0rpx;background-size:100% auto !important;
    }
    .informationSettlement_fd1_1_c1_c0{
        color:#333333;font-size:32rpx;font-weight:400;line-height:40rpx;
    }
    .informationSettlement_fd1_1_c0_c1{
        text-align:right;font-size:28rpx;font-weight:400;color:#333;margin:0rpx 16rpx 0rpx 32rpx;
    }
    .informationSettlement_fd1_1_c0_c0{
        color:#333333;font-size:28rpx;font-weight:400;line-height:40rpx;
    }
    .informationSettlement_fd1_1{
        padding:0rpx 32rpx 0rpx 32rpx;margin:0rpx 0rpx 0rpx 0rpx;
    }
    .informationSettlement_fd1_0_c3{
        background:#fff;padding:30rpx 0rpx 30rpx 0rpx;background-size:100% auto !important;
    }
    .informationSettlement_fd1_0_c2_c1_image{
        width:160rpx;height:160rpx;
    }
    .informationSettlement_fd1_0_c1_c1{
        text-align:right;font-size:32rpx;font-weight:400;color:#333;margin:0rpx 0rpx 0rpx 32rpx;
    }
    .informationSettlement_fd1_0_c1{
        border-bottom:1px solid #eee;background:#fff;background-size:100% auto !important;padding:32rpx 0rpx 32rpx 0rpx;
    }
    .informationSettlement_fd1_0_c0_c2{
        width:12rpx;height:22rpx;
    }
    .informationSettlement_fd1_0_c0_c1{
        text-align:right;font-size:32rpx;font-weight:400;color:#333;margin:0rpx 16rpx 0rpx 32rpx;
    }
    .informationSettlement_fd1_0_c0_c0{
        color:#333333;font-size:32rpx;font-weight:400;line-height:45rpx;
    }
    .informationSettlement_fd1_0_c0{
        border-bottom:1px solid #eee;background:#fff;padding:30rpx 0rpx 30rpx 0rpx;background-size:100% auto !important;
    }
    .informationSettlement_fd1_0{
        padding:0rpx 32rpx 0rpx 32rpx;
    }
    .informationSettlement_picker2_0_c2{
        color:var(--benbenFontColor5);font-size:32rpx;font-weight:500;line-height:40rpx;
    }
    .informationSettlement_picker2_0_c0{
        color:#BFBFBF;font-size:32rpx;font-weight:500;line-height:40rpx;
    }
    .informationSettlement_picker2_0{
        border-bottom:1px solid #eee;background:#fff;padding:0rpx 32rpx 0rpx 32rpx;line-height:90rpx;border-radius:25rpx 25rpx 0rpx 0rpx;background-size:100% auto !important;height:90rpx;
    }
</style>